package com.ziyun.erp.modules.purchase.service.impl;

import com.ziyun.erp.modules.purchase.entity.StorePurchaseApplyEntity;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import com.ziyun.erp.modules.purchase.dao.StorePurchaseApplyDetailDao;
import com.ziyun.erp.modules.purchase.entity.StorePurchaseApplyDetailEntity;
import com.ziyun.erp.modules.purchase.service.StorePurchaseApplyDetailService;

/**
 * 门店采购申请
 *
 * @author guizhao
 * @email
 * @date 2018-09-26 13:28:47
 */
@Service("storePurchaseApplyDetailService")
public class StorePurchaseApplyDetailServiceImpl extends ServiceImpl<StorePurchaseApplyDetailDao, StorePurchaseApplyDetailEntity> implements StorePurchaseApplyDetailService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        Page<StorePurchaseApplyDetailEntity> page = this.selectPage(
                new Query<StorePurchaseApplyDetailEntity>(params).getPage(),
                new EntityWrapper<StorePurchaseApplyDetailEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public void saveBatch(List<StorePurchaseApplyDetailEntity> detialListSave, StorePurchaseApplyEntity storePurchaseApplyEntity) {
        baseMapper.saveBatch(detialListSave,storePurchaseApplyEntity);
    }

    // update 查出耗材名称和规格
    @Override
    public List<StorePurchaseApplyDetailEntity> queryList(Integer applyId) {
        List<StorePurchaseApplyDetailEntity> storePurchaseApplyDetailEntityList = baseMapper.selectStorePurchaseApply(applyId);
        return storePurchaseApplyDetailEntityList;
    }

    @Override
    public void updateByMap(Map<String, Object> map, Integer id) {
        baseMapper.updateByMap(map,id);
    }

}
